Skip to content

BehaviorSignal.TryGetValue(T?) method

Defined in

Type: BehaviorSignal Namespace: ReactiveUI.Primitives.Signals Assembly: ReactiveUI.Primitives.Core.dll

Applies to

net10.0, net10.0, net10.0-desktop1.0, net10.0-desktop1.0, net10.0-browserwasm1.0, net10.0-browserwasm1.0, net9.0, net9.0, net9.0-desktop1.0, net9.0-desktop1.0, net9.0-browserwasm1.0, net9.0-browserwasm1.0, net8.0, net8.0, net8.0-ios17.5, net8.0-macos14.5, net8.0-macos14.5, net8.0-macos14.2, net8.0-macos14.2, net8.0-maccatalyst17.5, net8.0-maccatalyst17.5, net8.0-tvos17.2, net8.0-tvos17.2, net8.0-ios17.5, netstandard2.1, netstandard2.1, net481, net462, net462, net481

public bool TryGetValue(out T? value)

View source

Summary: Tries to get the current value or throws an exception.

Parameters

NameTypeDescription
out valueT?The initial value passed to the constructor until [OnNext](# is called; after which, the last value passed to [OnNext](#

Returns: bool -- true if a value is available; false if the subject was disposed.

Remarks

The value returned from TryGetValue is frozen after OnCompleted is called.

After OnError is called, TryGetValue always throws the specified exception.

Calling TryGetValue is a thread-safe operation, though there's a potential race condition when OnNext or OnError are being invoked concurrently. In some cases, it may be necessary for a caller to use external synchronization to avoid race conditions.